<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery/jquery.min.js"></script>
    <script>
        $(function () {
            //保存
            $('#save').click(function () {
                $.post("/employees",{name:"刘某",age:18},function (data) {
                    console.log(data)
                })
            });

            $('#delete').click(function () {
                $.ajax({
                    url:"/employees",
                    type:"delete",
                    data:{id:1},
                    success:function(data){
                        console.log(data)
                    }
                })
            });

            $('#update').click(function () {
                $.ajax({
                    url:"/employees",
                    type:"put",
                    data:{id:1,name:"刘某",age:18},
                    success:function(data){
                        console.log(data)
                    }
                })
            });


            $('#get').click(function () {
                $.get("/employees/8899",function (data) {
                    console.log(data)
                })
            });

            $('#list').click(function () {
                //{}可以省略
                $.get("/employees",{},function (data) {
                    console.log(data)
                })
            });
        })
    </script>
</head>
<body>
 <button id="save">添加</button>
 <button id="delete">删除</button>
 <button id="update">修改</button>
 <button id="get">查询</button>
 <button id="list">查询所有</button>
</body>
</html>